Fix the save loading bug that corrupts saves - #7
Open
JusticarProgramming wants to merge 1 commit into
Open
Conversation
JusticarProgramming
force-pushed
the
fix/save-version-load-string
branch
from
August 29, 2026 06:45
f885b1c to
5f48b74
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SaveVersionInfo::Load_String assembles the version strings of save files written with the older one-stream-per-value layout. Its wide-character buffer was declared inside the read loop, so every character was written into a fresh, uninitialised buffer and the string was read back as garbage; once the index ran past the end of the buffer it was also written out of bounds.
The buffer now spans the whole read and the loop stops before the buffer ends, so the scenario description, player house, executable name, and player name load as their saved text.
Behaviour and compatibility
Bug fix.
Affected boundary: save files, reading the version strings from the older one-stream-per-value layout.
The save format itself is unchanged, so no migration is required and supports existing saves..
Validation
Visual Studio 17 2022,-A Win32; MSVC 19.44.35220, Windows SDK 10.0.26100.0.GameD.exe).Game.exe).logstress).unit.cppC5055), unrelated to this change; no new warnings fromsavever.cppDocumentation
No change needed.
Checklist